<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

// 密码加密
if(!function_exists('encrypt_password')){
    function encrypt_password($password){
        $salt = 'dsafgdfsfsd';
        return md5(md5(trim($password).$salt));
    
    }}
    if(!function_exists('get_tree_list')){
        function get_tree_list($list){
            //将每条数据中的id值作为其下标
            $temp = [];
            foreach($list as $v){ 
                $v['son'] = [];
                $temp[$v['id']] = $v;
            }
            //获取分类树
            foreach($temp as $k=>$v){
                $temp[$v['pid']]['son'][] = &$temp[$v['id']];
            }
            return isset($temp[0]['son']) ? $temp[0]['son'] : [];
        }
    }
  